export function privatePhone(val, retain = 4) {
	if (!NUMBER(val) || String(val).length !== 11 || retain == 0) return val;
	let phone = String(val)
	let digit = 11 - 3 - retain
	let reg = new RegExp(`^(\\d{3})\\d{${digit}}(\\d{${retain}})$`)
	return mobile.replace(reg, `$1${'*'.repeat(digit)}$2`)
}


// // 全局过滤器--时间戳格式化时间
export function dateFormat(originVal) {
  const dt = new Date(originVal*1000)

  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
}

